package com.woniu.service.contentService.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.mapper.contentService.InformationMapper;
import com.woniu.model.contentMService.entity.Information;
import com.woniu.service.contentService.IInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 咨询部 服务实现类
 * </p>
 *
 * @author 作者
 * @since 2023-10-20
 */
@Service
public class InformationServiceImpl extends ServiceImpl<InformationMapper, Information> implements IInformationService {

    @Autowired
    private InformationMapper informationMapper;

    @Override
    public PageInfo<Information> findByPage(Map<String, Object> condition) {
        //1.设置PageHelper参数
        PageHelper.startPage(condition); //自动从对象中找pageNum和pageSize的参数去分页
        //2.调用DAO层查询所有的记录
        List<Information> list = informationMapper.findByPage(condition);
        //3.返回PageInfo对象
        return new PageInfo<>(list);
    }
}
